package com.mybed.crm.utils.thread;

public class UserThreadLocalUtil {
    private final static ThreadLocal<String> USER_USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 添加用户
     * @param userId
     */
    public static void  setUser(String userId){
        USER_USER_THREAD_LOCAL.set(userId);
    }

    /**
     * 获取用户
     */
    public static String getUser(){
        return USER_USER_THREAD_LOCAL.get();
    }

    /**
     * 清理用户
     */
    public static void clear(){
        USER_USER_THREAD_LOCAL.remove();
    }
}
